import request from '@/utils/request'

// ------ 评论审核 ------
export const getEvaluations = (pageNum = 1, pageSize = 10, auditStatus) =>
  request.get('/api/evaluation/admin/list', {
    params: { pageNum, pageSize, auditStatus }
  })

export const approveEvaluation = (id) =>
  request.post(`/api/evaluation/admin/${id}/approve`)

export const deleteEvaluation = (id) =>
  request.post(`/api/evaluation/admin/${id}/delete`)


// 用户审核相关
export const getUsers = (pageNum = 1, pageSize = 10, status, keyword) =>
  request.get('/api/user-account/admin/list', { params: { pageNum, pageSize, status, keyword } })

export const disableUser = (id) =>
  request.post(`/api/user-account/admin/${id}/disable`)

export const enableUser = (id) =>
  request.post(`/api/user-account/admin/${id}/enable`)

export const getPromotionList = (pageNum, pageSize, params = {}) => {
  return request.get('/api/promotion-activity/admin/list', {
    params: { pageNum, pageSize, ...params }
  })
}

export const createPromotion = (data) => {
  return request.post('/api/promotion-activity/admin', data)
}

export const updatePromotion = (data) => {
  return request.put('/api/promotion-activity/admin', data)
}

export const deletePromotion = (id) => {
  return request.delete(`/api/promotion-activity/admin/${id}`)
}

export const getCategoryPage = (pageNum = 1, pageSize = 10, keyword = '') =>
  request.get('/api/category/page', { params: { pageNum, pageSize, keyword } })

export const createCategory = (data) => request.post('/api/category', data)

export const updateCategory = (id, data) => request.put(`/api/category/${id}`, data)

export const deleteCategory = (id) => request.delete(`/api/category/${id}`)
